package LECONGHAU.STRUCTURE_PROGRAMMING.EXCERCISES;

import java.util.Scanner;

public class bai6for {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String so,chon;
do{
	System.out.println("nhap vao so");
	Scanner sc=new Scanner(System.in);
	so=sc.nextLine();
	System.out.println("chon kieu 0->chan, 1->le");
	chon=sc.nextLine();
	if(so.isEmpty()||chon.isEmpty()){
		System.out.println("vui long nhap lai");
	}
}while(so.isEmpty()||chon.isEmpty());
int intso=Integer.parseInt(so);
int intchon=Integer.parseInt(chon);
int sodau=0;
int dem = 0;
switch (intchon) {
case 0:
for(int i=0;i<=intso;i++){
		
		if(i%2==0){
			dem++;
		}
		
	}
	System.out.println("so so chan la "+dem);
	break;
case 1:
	for(int i=0;i<=intso;i++){
		
		if(i%2!=0){
			dem++;
		}
		
	}
	System.out.println("so so le la"+dem);
	break;

default:System.out.println("chon nham roi nha");
	break;
}

	}

}
